import request from '@/utils/request';
// 分页查询课程信息
export const getCourses = (data) => request({
  method: 'POST',
  url: '/boss/course/getQueryCourses',
  data,
});

export const getCourseById = (params) => request({
  method: 'GET',
  url: '/boss/course/getCourseById',
  params,
});

export const getSections = (params) => request({
  method: 'GET',
  url: '/boss/course/section/getSectionAndLesson',
  params,
});

export const getBySectionId = (sectionId) => request({
  method: 'GET',
  url: '/boss/course/section/getBySectionId',
  params: { sectionId },
});

export const getLessonById = (lessonId) => request({
  method: 'GET',
  url: '/boss/course/lesson/getById',
  params: { lessonId },
});

// 上传图片
export const uploadCourseImage = (data, onUploadProgress) => request({
  method: 'POST',
  url: '/boss/course/upload',
  data,
  onUploadProgress,
});

export const UpdateCourse = (data) => request({
  method: 'POST',
  url: '/boss/course/saveOrUpdateCourse',
  data,
});

export const UpdateSection = (data) => request({
  method: 'POST',
  url: '/boss/course/section/saveOrUpdateSection',
  data,
});

export const UpdateLesson = (data) => request({
  method: 'POST',
  url: '/boss/course/lesson/saveOrUpdate',
  data,
});

// 课程上下架
export const CourseChangeState = (params) => request({
  method: 'GET',
  url: '/boss/course/changeState',
  params,
});

export default {};
